﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using System.Web.Script.Serialization;
using System.IO;

namespace WebBHXH.Entities
{
    class MucBHModel
    {
        public MucBHModel()
        {
        }
        public MucBHModel(string json)
        {
            JObject jObject = JObject.Parse(json);
            maMucBH = (string)jObject["Ma_MucBH"];
            tenMucBH = (string)jObject["Ten_MucBH"];
            ghiChu = (string)jObject["GhiChu"];
        }

        public List<MucBHModel> GetMucBHModel()
        {
            System.Net.WebRequest request = System.Net.WebRequest.Create("" + Util.getUrl() + "Home/GetMucBHModel");

            request.Method = "POST";
            request.ContentLength = 0;
            request.ContentType = "application/json; charset=utf-8";
            JavaScriptSerializer json_serializer = new JavaScriptSerializer();
            //get response-stream, and use a streamReader to read the content
            List<MucBHModel> listMucBHModel = new List<MucBHModel>();
            using (Stream s = request.GetResponse().GetResponseStream())
            {
                using (StreamReader sr = new StreamReader(s))
                {
                    JavaScriptSerializer jsonserializer = new JavaScriptSerializer();
                    listMucBHModel = jsonserializer.Deserialize<List<MucBHModel>>(sr.ReadToEnd());
                    return listMucBHModel;
                }
            }
            return new List<MucBHModel>();
        }

        private string maMucBH;

        public string MaMucBH
        {
            get { return maMucBH; }
            set { maMucBH = value; }
        }
        private string tenMucBH;

        public string TenMucBH
        {
            get { return tenMucBH; }
            set { tenMucBH = value; }
        }
        private string ghiChu;

        public string GhiChu
        {
            get { return ghiChu; }
            set { ghiChu = value; }
        }

    }
}
